﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace MidSoft.Web.Model_T_SYS_ALERTINFO
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtALERTINFO_ID.Text.Trim().Length==0)
			{
				strErr+="ID不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtCREATE_TIME.Text))
			{
				strErr+="创建时间格式错误！\\n";	
			}
			if(this.txtCONTENT.Text.Trim().Length==0)
			{
				strErr+="内容不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtEXPRIE_DATE.Text))
			{
				strErr+="过期时间格式错误！\\n";	
			}
			if(this.txtOBJECT_ID.Text.Trim().Length==0)
			{
				strErr+="对象ID不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtOBJECT_TYPE.Text))
			{
				strErr+="对象类型格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtOPERATION_TYPE.Text))
			{
				strErr+="操作类型格式错误！\\n";	
			}
			if(this.txtGROUP_ID.Text.Trim().Length==0)
			{
				strErr+="用户组ID不能为空！\\n";	
			}
			if(this.txtOWNER_ID.Text.Trim().Length==0)
			{
				strErr+="用户ID不能为空！\\n";	
			}
			if(this.txtPET_ID.Text.Trim().Length==0)
			{
				strErr+="宠物ID不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtID.Text))
			{
				strErr+="原ID格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string ALERTINFO_ID=this.txtALERTINFO_ID.Text;
			DateTime CREATE_TIME=DateTime.Parse(this.txtCREATE_TIME.Text);
			string CONTENT=this.txtCONTENT.Text;
			DateTime EXPRIE_DATE=DateTime.Parse(this.txtEXPRIE_DATE.Text);
			string OBJECT_ID=this.txtOBJECT_ID.Text;
			decimal OBJECT_TYPE=decimal.Parse(this.txtOBJECT_TYPE.Text);
			decimal OPERATION_TYPE=decimal.Parse(this.txtOPERATION_TYPE.Text);
			string GROUP_ID=this.txtGROUP_ID.Text;
			string OWNER_ID=this.txtOWNER_ID.Text;
			string PET_ID=this.txtPET_ID.Text;
			decimal ID=decimal.Parse(this.txtID.Text);

			MidSoft.Model.Model_T_SYS_ALERTINFO model=new MidSoft.Model.Model_T_SYS_ALERTINFO();
			model.ALERTINFO_ID=ALERTINFO_ID;
			model.CREATE_TIME=CREATE_TIME;
			model.CONTENT=CONTENT;
			model.EXPRIE_DATE=EXPRIE_DATE;
			model.OBJECT_ID=OBJECT_ID;
			model.OBJECT_TYPE=OBJECT_TYPE;
			model.OPERATION_TYPE=OPERATION_TYPE;
			model.GROUP_ID=GROUP_ID;
			model.OWNER_ID=OWNER_ID;
			model.PET_ID=PET_ID;
			model.ID=ID;

			MidSoft.BLL.BLL_T_SYS_ALERTINFO bll=new MidSoft.BLL.BLL_T_SYS_ALERTINFO();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
